package com.xrf;

import java.util.ArrayList;
import java.util.List;
import java.util.Scanner;

public class ProjectManagement {
    private String projectScheduling;
    private Long repositoryQuery;
    private Long newProjectInformation;
    private Double editProjectInformation;
    private Double handleContractInformation;
    private Long projectInvestmentEstimationScheme;
    private String projectHandlingCostManagement;
    private Long projectFlowInformationExport;
    private Double projectHourInquiry;
    private Double putAsEalon;

    private static List<ProjectManagement> list = new ArrayList<>();
    private static Scanner scanner = new Scanner(System.in);

    public ProjectManagement() {}

    public ProjectManagement(String projectScheduling, Long repositoryQuery, Long newProjectInformation,
                           Double editProjectInformation, Double handleContractInformation,
                           Long projectInvestmentEstimationScheme, String projectHandlingCostManagement,
                           Long projectFlowInformationExport, Double projectHourInquiry, Double putAsEalon) {
        this.projectScheduling = projectScheduling;
        this.repositoryQuery = repositoryQuery;
        this.newProjectInformation = newProjectInformation;
        this.editProjectInformation = editProjectInformation;
        this.handleContractInformation = handleContractInformation;
        this.projectInvestmentEstimationScheme = projectInvestmentEstimationScheme;
        this.projectHandlingCostManagement = projectHandlingCostManagement;
        this.projectFlowInformationExport = projectFlowInformationExport;
        this.projectHourInquiry = projectHourInquiry;
        this.putAsEalon = putAsEalon;
    }

    // Getter and Setter methods
    public String getProjectScheduling() { return projectScheduling; }
    public void setProjectScheduling(String projectScheduling) { this.projectScheduling = projectScheduling; }
    public Long getRepositoryQuery() { return repositoryQuery; }
    public void setRepositoryQuery(Long repositoryQuery) { this.repositoryQuery = repositoryQuery; }
    public Long getNewProjectInformation() { return newProjectInformation; }
    public void setNewProjectInformation(Long newProjectInformation) { this.newProjectInformation = newProjectInformation; }
    public Double getEditProjectInformation() { return editProjectInformation; }
    public void setEditProjectInformation(Double editProjectInformation) { this.editProjectInformation = editProjectInformation; }
    public Double getHandleContractInformation() { return handleContractInformation; }
    public void setHandleContractInformation(Double handleContractInformation) { this.handleContractInformation = handleContractInformation; }
    public Long getProjectInvestmentEstimationScheme() { return projectInvestmentEstimationScheme; }
    public void setProjectInvestmentEstimationScheme(Long projectInvestmentEstimationScheme) { this.projectInvestmentEstimationScheme = projectInvestmentEstimationScheme; }
    public String getProjectHandlingCostManagement() { return projectHandlingCostManagement; }
    public void setProjectHandlingCostManagement(String projectHandlingCostManagement) { this.projectHandlingCostManagement = projectHandlingCostManagement; }
    public Long getProjectFlowInformationExport() { return projectFlowInformationExport; }
    public void setProjectFlowInformationExport(Long projectFlowInformationExport) { this.projectFlowInformationExport = projectFlowInformationExport; }
    public Double getProjectHourInquiry() { return projectHourInquiry; }
    public void setProjectHourInquiry(Double projectHourInquiry) { this.projectHourInquiry = projectHourInquiry; }
    public Double getPutAsEalon() { return putAsEalon; }
    public void setPutAsEalon(Double putAsEalon) { this.putAsEalon = putAsEalon; }

    @Override
    public String toString() {
        StringBuilder builder = new StringBuilder();
        builder.append("项目排期:").append(projectScheduling).append("\t");
        builder.append("资源库查询:").append(repositoryQuery).append("\t");
        builder.append("新增项目信息:").append(newProjectInformation).append("\t");
        builder.append("编辑项目信息:").append(editProjectInformation).append("\t");
        builder.append("办理合同信息:").append(handleContractInformation).append("\t");
        builder.append("项目投资估算方案:").append(projectInvestmentEstimationScheme).append("\t");
        builder.append("项目办理费用管理:").append(projectHandlingCostManagement).append("\t");
        builder.append("项目流转信息导出:").append(projectFlowInformationExport).append("\t");
        builder.append("项目工时查询:").append(projectHourInquiry).append("\t");
        builder.append("打印:").append(putAsEalon).append("\t");
        return builder.toString();
    }

    public static void addData() {
        System.out.println("--------添加数据-------");
        System.out.println("请输入项目排期：");
        String projectScheduling = scanner.next();
        System.out.println("请输入资源库查询：");
        Long repositoryQuery = scanner.nextLong();
        System.out.println("请输入新增项目信息：");
        Long newProjectInformation = scanner.nextLong();
        System.out.println("请输入编辑项目信息：");
        Double editProjectInformation = scanner.nextDouble();
        System.out.println("请输入办理合同信息：");
        Double handleContractInformation = scanner.nextDouble();
        System.out.println("请输入项目投资估算方案：");
        Long projectInvestmentEstimationScheme = scanner.nextLong();
        System.out.println("请输入项目办理费用管理：");
        String projectHandlingCostManagement = scanner.next();
        System.out.println("请输入项目流转信息导出：");
        Long projectFlowInformationExport = scanner.nextLong();
        System.out.println("请输入项目工时查询：");
        Double projectHourInquiry = scanner.nextDouble();
        System.out.println("请输入打印：");
        Double putAsEalon = scanner.nextDouble();
        
        ProjectManagement data = new ProjectManagement(projectScheduling, repositoryQuery, newProjectInformation,
                                                     editProjectInformation, handleContractInformation,
                                                     projectInvestmentEstimationScheme, projectHandlingCostManagement,
                                                     projectFlowInformationExport, projectHourInquiry, putAsEalon);
        list.add(data);
    }

    public static void removeData() {
        System.out.println("--------删除数据-------");
        System.out.println("请输入索引：");
        int index = scanner.nextInt();
        if (index >= 0 && index < list.size()) {
            list.remove(index);
            System.out.println("删除成功！");
        } else {
            System.out.println("索引无效！");
        }
    }

    public static void updateData() {
        System.out.println("--------修改数据-------");
        System.out.println("请输入索引：");
        int index = scanner.nextInt();
        if (index >= 0 && index < list.size()) {
            System.out.println("请输入项目排期：");
            String projectScheduling = scanner.next();
            System.out.println("请输入资源库查询：");
            Long repositoryQuery = scanner.nextLong();
            System.out.println("请输入新增项目信息：");
            Long newProjectInformation = scanner.nextLong();
            System.out.println("请输入编辑项目信息：");
            Double editProjectInformation = scanner.nextDouble();
            System.out.println("请输入办理合同信息：");
            Double handleContractInformation = scanner.nextDouble();
            System.out.println("请输入项目投资估算方案：");
            Long projectInvestmentEstimationScheme = scanner.nextLong();
            System.out.println("请输入项目办理费用管理：");
            String projectHandlingCostManagement = scanner.next();
            System.out.println("请输入项目流转信息导出：");
            Long projectFlowInformationExport = scanner.nextLong();
            System.out.println("请输入项目工时查询：");
            Double projectHourInquiry = scanner.nextDouble();
            System.out.println("请输入打印：");
            Double putAsEalon = scanner.nextDouble();
            
            ProjectManagement data = new ProjectManagement(projectScheduling, repositoryQuery, newProjectInformation,
                                                         editProjectInformation, handleContractInformation,
                                                         projectInvestmentEstimationScheme, projectHandlingCostManagement,
                                                         projectFlowInformationExport, projectHourInquiry, putAsEalon);
            list.set(index, data);
            System.out.println("修改成功！");
        } else {
            System.out.println("索引无效！");
        }
    }

    public static void displayData() {
        System.out.println("--------数据显示-------");
        for (int i = 0; i < list.size(); i++) {
            System.out.println("索引 " + i + ": " + list.get(i));
        }
    }
}